Skip to main content

Hard ✔

  1. Longest Substring With At Most K Distinct Characters
    1. 02 April, 2026: 00.06.39 ✔
  2. Subarrays with K Different Integers
    1. 02 April, 2026: 00.16.35 ❌
      • Failed at edge cases
        • Count leading zeros
        • Traditional sliding window fail
        • Mistake:
          • Confused with Binary Subarray Sum problem
          • Used sum-based reasoning (incorrect)
        • Key Insight:
          • Problem is about DISTINCT elements, not sum
          • Sliding window works because:
            • We can track distinct count using hashmap
            • When distinct > k → shrink window deterministically
  3. Minimum Window Substring
    1. 04 April, 2026: 00.29.19 ❌
      • Failed at implementation
        • Extend: On each itration.
        • Shrink: If no item left
  4. Minimum Window Subsequence
    1. 06 April, 2026: 00.40.44 ❌
      • Doesn't follow sliding window template.
      • substr(start, length) → second parameter is length, not ending index.
      • Correct Approach:
        For every possible start:
        • Go forward → find a valid subsequence match
        • Go backward → shrink the window to make it minimal (remove duplicates)
        • Update answer